<template>
  <div>
    <div style="width: 48%; height: 40%; background-color: ; float:left;">
      <div style="margin:20px "><span style="font-size:24px">我的待办</span><span style="font-size:medium;opacity:0.4">/Pending Items</span></div>
      <div style="margin:20px ">
        <table border="0" cellspacing="0" >
          <tr align="center" >
            <td style="height:150px;width: 245px;" >
              <img src="../assets/Merchandise library.png" style="width:60px; opacity:0.6" @click="openPlan"/>
              <br>
              <span style="font-size:20px ; color: #409EFF;" >计划备货订单</span>
            </td>
            <td style="height:150px;width: 245px; " >
              <img src="../assets/order.png" style="width:60px; opacity:0.6" @click="openExamine">
              <br>
              <span style="font-size:20px ; color: #409EFF;">待审核订单</span>
            </td>
            <td style="height:150px;width: 245px; " >
              <img src="../assets/inventory.png" style="width:60px; opacity:0.6" @click="openRecheck">
              <br>
              <span style="font-size:20px ; color: #409EFF;">待复核订单</span>
            </td>
          </tr>
          <tr align="center" >
            <td style="height:150px;width: 245px;" >
              <img src="../assets/order.png" style="width:60px; opacity:0.6" @click="openNotice"/>
              <br>
              <span style="font-size:20px ; color: #409EFF;" >首页公告列表</span>
            </td>
            <td style="height:150px;width: 245px; " >
              <img src="../assets/order.png" style="width:60px; opacity:0.6" @click="openAdvisory">
              <br>
              <span style="font-size:20px ; color: #409EFF;">首页资讯列表</span>
            </td>
            <td style="height:150px;width: 245px; " >
              <img src="../assets/order.png" style="width:60px; opacity:0.6" @click="openInformation">
              <br>
              <span style="font-size:20px ; color: #409EFF;">首页信息平台列表</span>
            </td>
          </tr>
          </table>
      </div>
    </div>

    <div style="width: 48%; height: 40%; background-color: ; float:left;">
      <div style="margin:20px "><span style="font-size:24px">常用信息平台</span><span style="font-size:medium;opacity:0.4">/Common Information Platform</span></div>
      <div style="margin:20px ">
        <table border="0" cellspacing="0" >
          <tr align="center" >
            <td style="height:150px;width: 245px;" >
              <a href="https://www.csdn.net/"><img src="../assets/Snipaste_2022-12-08_21-58-32.png" style="width:200px; opacity:0.6" @click="openPlan"/></a>
              <br>
              
            </td>
            <td style="height:150px;width: 245px; " >
              
            </td>
            <td style="height:150px;width: 245px; " >
              
            </td>
          </tr>
          
          </table>
      </div>
    </div>
    <div style="width: 48%; height: 50%;  float:left;margin : 20px">
      
        <el-tabs v-model="activeName" @tab-click="handleClick">
          <el-tab-pane label="公告" name="first">
            <div>
            <el-table
            :data="tableData"     
            style="width: 100% "
            >
            <el-table-column
            prop="title"
            label="公告标题"
            style="font-size:10px;"
            width="630px"
            >
            </el-table-column>

            <el-table-column
            prop="publishDate"
            label="发布时间"
            >
            </el-table-column>
            </el-table>
            <div class="block" style="margin:10px 0">
              <el-pagination
                small=""
                @current-change="handleCurrentChange"
                :current-page.sync="currentPage"
                layout="total,  prev, pager, next"
                :total=this.total>
              </el-pagination>
            </div>
          </div>
          </el-tab-pane>
          <el-tab-pane label="集团新闻" name="second">
            <el-table
            :data="tableData2"
            style="width: 100% "
            >
            <el-table-column
            prop="title"
            label="资讯标题"
            style="font-size:10px"
            width="630px"
            >
            </el-table-column>

            <el-table-column
            prop="publishDate"
            label="发布时间"
            style="font-size:10px"
            >
            </el-table-column>
            </el-table>
            <div class="block" style="margin:10px 0">
              <el-pagination
                small=""
                @current-change="handleCurrentChange2"
                :current-page.sync="currentPage2"
                layout="total,  prev, pager, next"
                :total=this.total2>
              </el-pagination>
            </div>
          </el-tab-pane>
        </el-tabs>
      
    </div>
    <div style="width: 48%; height: 48%;  float:left;">
      <div style="margin:20px "><span style="font-size:24px">我的待办</span><span style="font-size:medium;opacity:0.4">/Pending Items</span></div>
      <div style="margin:20px ">
        <span style="font-size:40px;opacity:0.4">暂未开放</span>
      </div>
    </div>



  </div>
</template>

<script>
export default {
  name:'welcome',
  data() {
    return {
      tableData: [
      ],
      tableData2: [
      ],
      currentPage:1,
      currentPage2:1,
      rows:7,
      rows2:7,
      total:10,
      total2:10,
      type:'',
      status:'',
      activeName: 'first'
    }
  },
  created() {
        this.load()
        this.load2()
  },
  methods: {
    load(){
            this.$Ajax.get("getNoticeInfo",{
              params:{
                page:this.currentPage,
                rows:this.rows,
                type:'普通公告',
              }
            })
            .then(res =>{
            console.log(res),
            this.total = res.data.total
            this.tableData = res.data.rows
            })
    },
    load2(){
            this.$Ajax.get("getAdvisoryInfo",{
                params:{
                  page:this.currentPage2,
                  rows:this.rows,
                  status:'启用',
                }
              })
              .then(res =>{
              console.log(res),
              this.total2 = res.data.total
              this.tableData2 = res.data.rows
              })
    },

    handleCurrentChange(pagenum) {
            
            this.currentPage = pagenum
            console.log(`当前页: ${pagenum}`);
            this.load()
    },
    handleCurrentChange2(pagenum2) {
            
            this.currentPage2 = pagenum2
            console.log(`当前页: ${pagenum2}`);
            this.load2()
    },
    openPlan(){
      this.$router.push("/Plan")
    },
    openExamine(){
      this.$router.push("/Examine")
    },
    openRecheck(){
      this.$router.push("/Recheck")
    },
    openNotice(){
      this.$router.push("/Notice")
    },
    openAdvisory(){
      this.$router.push("/Advisory")
    },
    openInformation(){
      this.$router.push("/Information")
    },
    handleClick(tab, event) {
        console.log(tab, event);
    },
  },
}
</script>

<style>

</style>